<script setup>
import { ref } from "vue";
const pname = ref("张三");
const age = ref(18);
function changepname() {
  pname.value = ["李四", "王五", "赵六"][Math.floor(Math.random() * 3)];
}
function changeAge() {
  age.value++;
}
</script>

<template>
  <div class="app-container">
    <span>{{ pname }}</span>
    <span>{{ age }}</span>
    <button onclick="changepname()">修改名称</button>
    <button onclick="changeAge()">修改年龄</button>
  </div>
</template>

<style>
.app-container {
  padding: 20px;
  border: 1px solid silver;
}
</style>
